<!--suppress ALL -->
<include file="./Template/header.html" />

<link rel="stylesheet" type="text/css" href="/Template/css/exam.css">
<script type="text/javascript" src="/Template/js/amazeui.js"></script>
<script type="text/javascript">


    $(function() {

        //初始化页面配置
        initPage("足踝检测评估");

//        $("#pronationCheck input[type='checkbox']").click(function() {
//            lert(113);
//            if($(this).is(":checked")){
//                alert(123);
//            }
//        });
        $("textarea").keypress(function(e) {
            if (e.which == 13) {
                return false;
            }
        });
        var app = new Vue({
            el: '#container',
            data: {
            },
            methods: {
                cancel: function() {
                    window.location.href = "/wechat/workorder/index/id/{$workorderId}";
                },
                save: function() {
                    var examBasicId = $("input[name=examBasicId]").val();
                    var workorderId = $("input[name=workorderId]").val();

                    var side  = $("select[name=side]").val();
                    var mobility  = $("select[name=mobility]").val();
                    var shankcontrol  = $("select[name=shankcontrol]").val();
                    var footarch  = $("select[name=footarch]").val();
                    var notefootarch = $("input[name=notefootarch]").val();
                    var toe = $("select[name=toe]").val();
                    var notetoe = $("input[name=notetoe]").val();
                    var forefoot  = $("select[name=forefoot]").val();
                    var complforefoot  = $("select[name=complforefoot]").val();
                    var noteforefoot = $("input[name=noteforefoot]").val();
                    var heela = $("select[name=heela]").val();
                    var heelb = $("select[name=heelb]").val();
                    var heelaangle = $("input[name=heelaangle]").val();
                    var heelbangle = $("input[name=heelbangle]").val();
                    var complheel = $("select[name=complheel]").val();
                    var noteheel = $("input[name=noteheel]").val();
                    var heightHeel = $("input[name=heightHeel]").val();
                    var shoeType  = $("select[name=shoeType]").val();
                    var shoeSize = $("input[name=shoeSize]").val();
                    var burden = $("select[name=burden]").val();
                    var discomfort = $("textarea[name=discomfort]").val().replace(/[\r\n]/g,"");
                    var anklesymmetry = $("textarea[name=anklesymmetry]").val().replace(/[\r\n]/g,"");
                    var dysfunction = $("textarea[name=dysfunction]").val().replace(/[\r\n]/g,"");
                    var takephoto = $("input[name=takephoto]").is(":checked")? "1":"";
                    var takevideo = $("input[name=takevideo]").is(":checked")? "1":"";

                    var gait = "";
                    $('input[type="checkbox"][name="gait_id"]:checked').each(function () {
                        if(gait == ""){
                            gait = $(this).val();
                        }else{
                            gait += "," + $(this).val();
                        }
                    });
                    var notegait = $("input[name=notegait]").val();

                    var completed = "1";
                    if(isNullOrEmpty(side &&
                        mobility &&
                        shankcontrol &&
                        gait &&
                        footarch &&
                        toe &&
                        forefoot &&
                        complforefoot &&
                        complheel &&
                        heightHeel &&
                        shoeType &&
                        shoeSize &&
                        burden &&
                        discomfort &&
                        anklesymmetry &&
                        dysfunction &&
                        takephoto &&
                        takevideo
                        )) {
                        completed = "-1";
                    }
//                    if((pronation == ",") &&
//                        (supination == ",")) {
//                        completed = "-1";
//                    }


                    $.ajax({
                        url:"/wechat/workorder/examBasicPost",
                        type:"post",
                        data:{
                            examBasicId: examBasicId,
                            workorderId: workorderId,

                            side: side,
                            mobility: mobility,
                            shankcontrol: shankcontrol,
                            gait: gait,
                            notegait: notegait,
                            footarch: footarch,
                            notefootarch: notefootarch,
                            toe: toe,
                            notetoe: notetoe,
                            forefoot: forefoot,
                            complforefoot: complforefoot,
                            noteforefoot: noteforefoot,
                            heela: heela,
                            heelb: heelb,
                            heelaangle: heelaangle,
                            heelbangle: heelbangle,
                            complheel: complheel,
                            noteheel: noteheel,
                            heightHeel: heightHeel,
                            shoeType: shoeType,
                            shoeSize: shoeSize,
                            burden: burden,
                            discomfort: discomfort,
                            anklesymmetry: anklesymmetry,
                            dysfunction: dysfunction,
                            takephoto: takephoto,
                            takevideo: takevideo,

                            completed:completed,
                        },
                        dataType:"JSON",
                        beforeSend:function(){
                            $("#loadingToast").show();
                        },
                        complete:function(){
                            $('#loadingToast').hide();
                        },
                        success:function(data){
                            if(data.code == 200) {
//                                alert(data.alert);
                                alert("保存成功");
                                window.location.href = "/wechat/workorder/index/id/{$workorderId}";
                            }
                        },
                    })

                }
            }
        })
        $(".item select").change(function() {
            var value = $(this).find("option:selected").text();
            $(this).prev().val(value);
        });
        $("select[name=heela]").change(function() {
            var value = $(this).val();
            if(value == "中立位"){
                $(".heelaangle").hide();
            }else{
                $(".heelaangle").show();
            }
        });
        $("select[name=heelb]").change(function() {
            var value = $(this).val();
            if(value == "中立位"){
                $(".heelbangle").hide();
            }else{
                $(".heelbangle").show();
            }
        });
        if($("select[name=heela]").val() == "中立位"){
            $(".heelaangle").hide();
        }
        if($("select[name=heelb]").val() == "中立位"){
            $(".heelbangle").hide();
        }
    })

</script>

<div class="container" id="container">
    <div class="hint-info">
        <span class="update_time">{$formDict.update_time}：{$examBasic.update_time}</span>
        <span class="employee_name">{$formDict.update_name}：{$employeeName}</span>
    </div>
    <div class="edit-info">
        <div class="edit-content" >
            <input type="text" style="display: none;" name="workorderId" value="{$workorderId}">
            <input type="text" style="display: none;" name="examBasicId" value="{$examBasicId}">

            <div class="item">
                <span>位置：</span>
                <input id="side" type="text" value="{$examBasic.side}" readonly placeholder="请选择">
                <select name="side">
                    <option value="{$examBasic.side}">请选择</option>
                    {:getFormDictSelectOption($examBasic['side'],'side','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item">
                <span>行动能力：</span>

                <input id="mobility" type="text" value="{$examBasic.mobility}" readonly placeholder="请选择">
                <select name="mobility">
                    <option value="{$examBasic.mobility}">请选择</option>
                    {:getFormDictSelectOption($examBasic['mobility'],'mobility','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt=""></div>
            <div class="item">
                <span>小腿控制能力：</span>
                <input id="shankcontrol" type="text" value="{$examBasic.shankcontrol}" readonly placeholder="请选择">
                <select name="shankcontrol">
                    <option value="{$examBasic.shankcontrol}">请选择</option>
                    {:getFormDictSelectOption($examBasic['shankcontrol'],'shankcontrol','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <!--div class="item">
                <span>步态：</span>
                <input id="gait" type="text" value="{$examBasic.gait}" readonly placeholder="请选择">
                <select name="gait">
                    <option value="{$examBasic.gait}">请选择</option>
                    {:getFormDictSelectOption($examBasic['gait'],'gait','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div-->
            <div class="item" id="gaitCheck" style="border-bottom:0px">
                <span>步态：</span>
                <php>
                    for($i=0; $i<15; $i++) {
                    $gaitArr[$i]["id"] = $i;
                    $gaitArr[$i]["name"] = $formDict["gait_".$i];
                    }
                    if (!isNullOrEmpty($examBasic["gait"])) {
                    $gaitid=explode(',', $examBasic["gait"]);
                    }
                </php>
                <br>
                <foreach name="gaitArr" item="vo">
                    <label class="checkbox inline">
                        <php>$gait_checked=in_array($vo['id'],$gaitid)?"checked":"";</php>
                        <input value="{$vo.id}" type="checkbox" name="gait_id" {$gait_checked}>{$vo.name}
                        <php>if($vo['id']%4 == 3) echo("<br>");</php>
                    </label>
                </foreach>
            </div>
            <div class="item"><span></span><input name="notegait" type="text" value="{$examBasic.notegait}" placeholder="请填写步态相关备注"></div>
            <div class="item">
                <span>取型时负重状态：</span>
                <input id="burden" type="text" value="{$examBasic.burden}" readonly placeholder="请选择">
                <select name="burden">
                    <option value="{$examBasic.burden}">请选择</option>
                    {:getFormDictSelectOption($examBasic['burden'],'burden','exam_measure',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item" style="border-bottom:0px">
                <span>脚趾：</span>
                <input id="toe" type="text" value="{$examBasic.toe}" readonly placeholder="请选择">
                <select name="toe">
                    <option value="{$examBasic.toe}">请选择</option>
                    {:getFormDictSelectOption($examBasic['toe'],'toe','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item"><span></span><input name="notetoe" type="text" value="{$examBasic.notetoe}" placeholder="请填写脚趾相关备注"></div>

            <div class="item" style="border-bottom:0px">
                <span>前足：</span>
                <input id="forefoot" type="text" value="{$examBasic.forefoot}" readonly placeholder="请选择">
                <select name="forefoot">
                    <option value="{$examBasic.forefoot}">请选择</option>
                    {:getFormDictSelectOption($examBasic['forefoot'],'forefoot','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item" style="border-bottom:0px">
                <span></span>
                <input id="complforefoot" type="text" value="{$examBasic.complforefoot}" readonly placeholder="请选择">
                <select name="complforefoot">
                    <option value="{$examBasic.complforefoot}">请选择</option>
                    {:getFormDictSelectOption($examBasic['complforefoot'],'complforefoot','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item"><span></span><input name="noteforefoot" type="text" value="{$examBasic.noteforefoot}" placeholder="请填写前足相关备注"></div>

            <div class="item" style="border-bottom:0px">
                <span>中足(足弓)：</span>
                <input id="footarch" type="text" value="{$examBasic.footarch}" readonly placeholder="请选择">
                <select name="footarch">
                    <option value="{$examBasic.footarch}">请选择</option>
                    {:getFormDictSelectOption($examBasic['footarch'],'footarch','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item"><span></span><input name="notefootarch" type="text" value="{$examBasic.notefootarch}" placeholder="请填写中足(足弓)相关备注"></div>

            <div class="item" style="border-bottom:0px">
                <span>后足(跟骨)：</span>
                <input id="complheel" type="text" value="{$examBasic.complheel}" readonly placeholder="请选择">
                <select name="complheel">
                    <option value="{$examBasic.complheel}">请选择</option>
                    {:getFormDictSelectOption($examBasic['complheel'],'complheel','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item" style="border-bottom:0px">
                <span>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp负重位：</span>
                <input id="heel" type="text" value="{$examBasic.heela}" readonly placeholder="请选择">
                <select name="heela">
                    <option value="{$examBasic.heela}">请选择</option>
                    {:getFormDictSelectOption($examBasic['heela'],'heel','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item heelaangle" style="border-bottom:0px"><span></span><input name="heelaangle" type="text" value="{$examBasic.heelaangle}" placeholder="请填写负重位内外翻度数"></div>
            <div class="item" style="border-bottom:0px">
                <span>&nbsp&nbsp非负重位：</span>
                <input id="heel" type="text" value="{$examBasic.heelb}" readonly placeholder="请选择">
                <select name="heelb">
                    <option value="{$examBasic.heelb}">请选择</option>
                    {:getFormDictSelectOption($examBasic['heelb'],'heel','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item heelbangle" style="border-bottom:0px"><span></span><input name="heelbangle" type="text" value="{$examBasic.heelbangle}" placeholder="请填写非负重位内外翻度数"></div>
            <div class="item"><span>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp备注:</span><input name="noteheel" type="text" value="{$examBasic.noteheel}" placeholder="请填写足跟(跟骨)相关备注"></div>

            <div class="item"><span>{$formDict.height_heel}：</span><input name="heightHeel" type="text" value="{$examBasic.height_heel}" placeholder="请输入数据(mm)"></div>
            <div class="item" style="border-bottom:0px">
                <span>{$formDict.shoe_size}:</span>
                <input id="shoeType" type="text" value="{$examBasic.shoe_type}" readonly placeholder="请选择">
                <select name="shoeType">
                    <option value="{$examBasic.shoe_type}">请选择</option>
                    {:getFormDictSelectOption($examBasic['shoe_type'],'shoe_type','exam_basic',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <div class="item"><span></span><input name="shoeSize" type="text" value="{$examBasic.shoe_size}" placeholder="请输入鞋号"></div>

            <!--div class="item"><span>足中部(负重):</span><input name="burdenfoot" type="text" value="{$examBasic.burdenfoot}" placeholder="请输入数据"></div-->

            <div class="item">
                <span>感觉异常,慢性伤口,局部疼痛,老茧等：</span>
                <textarea class="t-area" name="discomfort" maxlength="80" placeholder="请填写">{$examBasic.discomfort}</textarea>
            </div>
            <div class="item">
                <span>内外踝对称性：</span>
                <textarea class="t-area" name="anklesymmetry" maxlength="80" placeholder="请填写">{$examBasic.anklesymmetry}</textarea>
            </div>
            <div class="item">
                <span>功能障碍描述及其他备注：</span>
                <textarea class="t-area" name="dysfunction" maxlength="120" placeholder="请填写">{$examBasic.dysfunction}</textarea>
            </div>
            <div class="item"  style="border-bottom:0px">
                <span></span>
                <div class="checkline_first">
                    <php>
                        $takephoto_checked=($examBasic["takephoto"] == 1)?"checked":"";
                    </php>
                    <span><input class="checkOther" name="takephoto" type="checkbox" {$takephoto_checked}> 已拍摄4方位照片</span>
                </div>
            </div>
            <div class="item">
                <span></span>
                <div class="checkline_first">
                    <php>
                        $takevideo_checked=($examBasic["takevideo"] == 1)?"checked":"";
                    </php>
                    <span><input class="checkOther" name="takevideo" type="checkbox" {$takevideo_checked}> 已拍摄4方位视频</span>
                </div>
            </div>
            <div class="line"></div>

        </div>
    </div>
    <div class="operation-btn">
        <div class="cancle-btn" v-on:click="cancel">取消</div>
        <if condition="$workorder['status'] lt '2' && $workorder['creator_id'] eq $customerId">
           <div class="save-btn" v-on:click="save">保存</div>
        <elseif condition="$workorder['status'] lt '3' && $job[0] eq 100"/>
            <div class="save-btn" v-on:click="save">保存</div>
        </if>
        <!--if condition="$workorder['status'] eq '2' && $workorder['examinator_id'] eq $customerId">
            <div class="save-btn" v-on:click="save">保存</div>
        </if-->
    </div>

</div>
<include file="./Template/footer.html" />